#ifndef __ENCODE_H_
#define __ENCODE_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "../arch_os.h"
#include "driver/gpio.h"
#include "key.h"

#include "../my_driver/gpio_drive.h"
#include "../Product_Config.h"
#include "../system_Config.h"
#include "../LOG.h"

#define ENCODE_SCAN_PERIOD TASK_SENSOR_DECT_PERIOD //编码器扫描周期
#define ENCODE_QUICK_TIME 60 //认定编码器快转的最大时间,单位ms

//编码器检测脚 
#define     GPIO_ENCODE_A               14  //A
#define     GPIO_ENCODE_B               27  //B


#define GET_ENCODER_A() device_gpio_get(GPIO_ENCODE_A)
#define GET_ENCODER_B() device_gpio_get(GPIO_ENCODE_B)
#define GET_PRESS device_gpio_get(GPIO_KEY1_OPT)

typedef enum
{
    ENCODER_ACT_NONE,
    ENCODER_ACT_TL_L,//1低速左旋
    ENCODER_ACT_TL_H,//2高速左旋
    ENCODER_ACT_TR_L,//3低速右旋
    ENCODER_ACT_TR_H,//4高速右旋
    ENCODER_PRE_TL,  //5按压左转
    ENCODER_PRE_TR,  //6按压右旋
    NUM_ENCODER_ACT,
}EM_ENCODER_ACT;

EM_ENCODER_ACT encoder_scan();
void encoder_init();



#endif
















